import {
  Body,
  Controller,
  Get,
  HttpCode,
  HttpStatus,
  Post,
  Request,
  UseGuards
} from '@nestjs/common';
import { AuthGuard } from './auth.guard';
import { AuthService } from './auth.service';
import { Public } from 'src/customDecorator';

@Controller('auth')
export class AuthController {
  constructor(private authService: AuthService) {}

  // 登录
  @HttpCode(HttpStatus.OK)
  @Post('signIn')
  signIn(@Body() signInDto: Record<string, any>) {
    return this.authService.signIn(signInDto.username, signInDto.password);
  }

  // 注册
  @HttpCode(HttpStatus.OK)
  @Post('signUp')
  signUp(@Body() signInDto: Record<string, any>) {
    return this.authService.signUp(signInDto.username, signInDto.password);
  }

   // 退出登录
   @HttpCode(HttpStatus.OK)
   @Post('signOut')
   signOut(@Body() signInDto: Record<string, any>) {
     return this.authService.signOut(signInDto.username);
   }

}
